﻿/*****************************************************
**Copyright(C), 2021-2022, Ciqtek Technology.
**Version:     2.0
**Author:      hujiarui
**Date:        2023/07/12
**Description: 场景基类
*****************************************************/

#ifndef BASEGRAPHICSSCENE_H
#define BASEGRAPHICSSCENE_H

#include "../../ofuidll_global.h"

#include <QGraphicsScene>
#include <QTime>

namespace OfUI {

	class BaseItemManager;
	class OFUIDLL_EXPORT BaseGraphicsScene : public QGraphicsScene
	{
		Q_OBJECT

	public:
		/**
		 * @brief  BaseGraphicsScene 构造函数
		 * @param  parent
		 * @return
		 */
		BaseGraphicsScene(QObject *parent = 0);

		/**
		 * @brief  ~BaseGraphicsScene 析构函数
		 * @return
		 */
		virtual ~BaseGraphicsScene();

	public:
		/**
		 * @brief  installManager 注册Manager
		 * @param  pManager
		 * @return void
		 */
		void installManager(BaseItemManager* pManager);

		/**
		 * @brief  removeManager 移出Manager
		 * @param  pManager
		 * @return void
		 */
		void removeManager(BaseItemManager* pManager);

	protected:
		/**
		 * @brief  eventFilter 重写事件过滤器
		 * @param  watched
		 * @param  event
		 * @return bool
		 */
		bool eventFilter(QObject *watched, QEvent *event) override;

	private:
		/** Manager列表
		 */
		QVector<BaseItemManager*>  m_managerList;

		/** 鼠标移动事件节流计时
		 */
		QTime m_moveTime;
	};

}

#endif // BASEGRAPHICSSCENE_H
